package com.example.hotel.service.impl;

import com.example.hotel.dao.OrdersDao;
import com.example.hotel.entity.Orders;
import com.example.hotel.service.OrdersService;
import com.example.hotel.vo.OrdersVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class OrdersServiceImpl implements OrdersService {
    @Autowired
    private OrdersDao ordersdao;
    @Override
    @Transactional
    public int addOrder(Orders o) {
        return ordersdao.addOrder(o);
    }

    @Override
    public int updateOrdersState(int orderId, String state) {
        return ordersdao.updateOrdersState(orderId,state);
    }

    @Override
    public List<OrdersVO> getAllOrders() {
        return ordersdao.getAllOrders();
    }

    @Override
    public int deleteOrder(int order_id) {
        return ordersdao.deleteOrder(order_id);
    }
}
